package hspedu.learn.javabase.extendsImporve;

import cn.itcast.javaobject.Person;

public class ExerciseOverride01 {
    public static void main(String[] args) {
        person jack = new person("Jack", 10);
        System.out.println(jack.say());
        stu zxl = new stu("zxl", 20, 5416132, 50);
        System.out.println(zxl.say());
    }
}
class person {
    private String name ;
    private int age;

    public person() {
    }

    public person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public String say() {
        return "name="+name+" age="+age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
class stu extends person{
    private int id;
    private double score;
    @Override
    public String say(){
        return super.say()+" id="+id +" score="+score;
    }

    public stu(String name, int age, int id, double score) {
        super(name, age);
        this.id = id;
        this.score = score;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }
}

